function check() {
    if (document.getElementsByName("password")[0].value !=
        document.getElementsByName("repeatedPassword")[0].value) {
        document.getElementsByName("errormsg")[0].innerText = "The two passwords are different."
        return false;
    }
    if(document.getElementsByName("firstName")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "First name should not be null."
        return false;
    }
    if(document.getElementsByName("lastName")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Last name should not be null."
        return false;
    }
    if(document.getElementsByName("email")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Email should not be null."
        return false;
    }
    if(document.getElementsByName("phone")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Phone should not be null."
        return false;
    }
    if(document.getElementsByName("address1")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Address1 should not be null."
        return false;
    }
    if(document.getElementsByName("address2")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Address2 should not be null."
        return false;
    }
    if(document.getElementsByName("city")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "City should not be null."
        return false;
    }
    if(document.getElementsByName("state")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "State should not be null."
        return false;
    }
    if(document.getElementsByName("zip")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Zip should not be null."
        return false;
    }
    if(document.getElementsByName("country")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Country should not be null."
        return false;
    }
    return true;
}